package com.funtl.spring.cloud.alibaba.consumer.controller;

import com.funtl.spring.cloud.alibaba.consumer.service.EchoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description :
 * @Author 刘龙
 * @Date 2020/3/9 21:37
 * @Version 1.0
 **/
@RefreshScope
@RestController
public class TestEchoController {

    @Autowired
    private EchoService echoService;

    @Value("${user.name}")
    private String name;

    @GetMapping(value = "/feign/echo")
    public String echo() {
        return echoService.echo(name);
    }

    @GetMapping(value = "/feign/echo/{string}")
    public String echo(@PathVariable("string") String string) {
        return echoService.echo(string);
    }

    @GetMapping(value = "/feign/lb")
    public String lb() {
        return echoService.lb();
    }

}
